
// 点击提醒确定提示框事件

function Ctf(msg, T, F,B){
	var html='<div id="confirm" style="width: 391px;height: 150px;position: fixed;z-index: 10001;left: 50%;top: 50%;margin-left: -195px;margin-top: -108px;background: #fff;border: 5px solid #8b0409;"><table width="100%" cellpadding="0" cellspacing="0" style="border: none;"><tr><td class="line"><div class="xx"  onclick="$(\'#confirm,#confirm_bg\').remove();'+(F?F:T)+';"></div></td></tr><tr height="40"><td align="center" >'+msg+'</td></tr><tr height="60"><td>';
	if (!B) {
		B = '取消';
	};
	if(F){
		html = html+'<div class="button_left" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">确定</div> <div class="button_right" onclick="$(\'#confirm,#confirm_bg\').remove();'+F+';">取消</div>';
	}else{
		html = html+'<div class="button_center" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">'+B+'</div>';
	}
		html = html+'</td> </tr></table></div><div id="confirm" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;z-index: 10000;zoom: 1;"></div>';
	$('body').prepend(html);
}

//结算前提示
function Ctcart(msg, T, F){
	var html='<div id="mask"></div><div id="confirm" style="width: 391px;height: 178px;position: fixed;z-index: 10001;left: 50%;top: 50%;margin-left: -195px;margin-top: -89px;background: #fff;border: 5px solid #8b0409; z-index: 99999999999;"><table width="100%" cellpadding="0" cellspacing="0" style="border: none;"><tr><td class="line"><div class="xx"  onclick="$(\'#confirm,#confirm_bg\').remove();'+(F?F:T)+';"></div></td></tr><tr height="40"><td align="left" style="margin-left: 28px; line-height: 25px; float:left;">'+'亲,有挑选到心动的宝贝么？<br/>此次购物您可以享受<span style=color:#8b0409;>全场包邮</span>的机会哦,<br/>赶紧抓住机会,返回商城把更多优惠一起带回家吧!'+'</td></tr><tr height="60"><td>';
	if(F){
		html = html+'<div class="button_left" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">提交订单</div> <div class="button_right" onclick="$(\'#confirm,#confirm_bg\').remove();'+F+';">返回修改</div>';
	}else{
		html = html+'<div class="button_center" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">取消</div>';
	}
		html = html+'</td> </tr></table></div><div id="confirm" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;z-index: 10000;zoom: 1;"></div>';
	$('body').prepend(html);
}

//提交订单前提示
function Ctz(msg, T, F){
	var html='<div id="confirm" style="width: 391px;height: 150px;position: fixed;z-index: 10001;left: 50%;top: 50%;margin-left: -195px;margin-top: -108px;background: #fff;border: 5px solid #8b0409;"><table width="100%" cellpadding="0" cellspacing="0" style="border: none;"><tr><td class="line"><div class="xx"  onclick="$(\'#confirm,#confirm_bg\').remove();'+(F?F:T)+';"></div></td></tr><tr height="40"><td align="center" >'+msg+'</td></tr><tr height="60"><td>';
	if(F){
		html = html+'<div class="button_left" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">提交订单</div> <div class="button_right" onclick="$(\'#confirm,#confirm_bg\').remove();'+F+';">返回修改</div>';
	}else{
		html = html+'<div class="button_center" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">取消</div>';
	}
		html = html+'</td> </tr></table></div><div id="confirm" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;z-index: 10000;zoom: 1;"></div>';
	$('body').prepend(html);
}

//有预购商品提交订单前提示
function CtzYugou(msg, T, F){
	var html='<div id="confirm" style="width: 391px;height: 150px;position: fixed;z-index: 10001;left: 50%;top: 50%;margin-left: -195px;margin-top: -108px;background: #fff;border: 5px solid #8b0409;"><table width="100%" cellpadding="0" cellspacing="0" style="border: none;"><tr><td class="line"><div class="xx"  onclick="$(\'#confirm,#confirm_bg\').remove();'+(F?F:T)+';"></div></td></tr><tr height="40"><td align="center" >'+msg+'</td></tr><tr height="60"><td>';
	if(F){
		html = html+'<div class="button_left" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">提交订单</div> <a class="button_right" href="http://weibo.com/u/1764928933?topnav=1&wvr=6&topsug=1" target="_blank">前往微博</a>';
	}else{
		html = html+'<div class="button_center" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">取消</div>';
	}
		html = html+'</td> </tr></table></div><div id="confirm" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;z-index: 10000;zoom: 1;"></div>';
	$('body').prepend(html);
}

//刮蛋乐兑换提示
function Ctt(msg, T, F){
	var html='<div id="confirm" style="width: 391px;height: 150px;position: fixed;z-index: 10001;left: 50%;top: 50%;margin-left: -195px;margin-top: -108px;background: #fff;border: 5px solid #8b0409;"><table width="100%" cellpadding="0" cellspacing="0" style="border: none;"><tr><td class="line"><div class="xx"  onclick="$(\'#confirm,#confirm_bg\').remove();'+(F?F:T)+';"></div></td></tr><tr height="40"><td align="center" >'+msg+'</td></tr><tr height="60"><td>';
	if(F){
		html = html+'<div class="button_left" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">确定</div> <div class="button_right" onclick="$(\'#confirm,#confirm_bg\').remove();'+F+';">取消</div>';
	}else{
		html = html+'<div class="button_center" onclick="$(\'#confirm,#confirm_bg\').remove();'+T+';">确定</div>';
	}
		html = html+'</td> </tr></table></div><div id="confirm" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;z-index: 10000;zoom: 1;"></div>';
	$('body').prepend(html);
}

//首页刮蛋乐兑换提示
function Cti(msg, T, F, name){
	var html='<div id="tips_guadanle" style="width: 343px;height: 163px; position: fixed;z-index: 10001; left: 50%; top: 50%; margin-left: -195px; margin-top: -108px; background: #fff; border: 2px solid #8b0409;"><table width="100%" cellpadding="0" cellspacing="0" style="border: none;"><tr height="110"><td align="center" >'+msg+'</td></tr><tr height="53"><td>';
	if(F){
		html = html+'<div class="prize">奖品</div><div class="goods_name">'+name+'</div><div class="button_left" onclick="$(\'#tips_guadanle,#tips_guadanle_bg\').remove();'+T+';">去购物车</div><div class="button_right" onclick="$(\'#tips_guadanle,#tips_guadanle_bg\').remove();'+F+';">留在首页</div>';
	}else{
		html = html+'<div class="button_center" onclick="$(\'#tips_guadanle,#tips_guadanle_bg\').remove();'+T+';">返回</div>';
	}
		html = html+'</td> </tr></table></div><div id="tips_guadanle" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;z-index: 10000;zoom: 1;"></div>';
	$('body').prepend(html);
}

//内容页购买提醒
function Ctf_ctock_remind(num, id, c_id){
	var html='<div id="confirm" style="width: 556px;height: 383px;position: fixed;z-index: 10001;left: 50%;top: 50%;margin-left: -278px;margin-top: -192px;background: url(/themes/default/pic/stock_remind.png)"><table width="100%" cellpadding="0" cellspacing="0" style="border: none;"><tr height="47"><td><div style="width: 47px;height: 47px;float: right;cursor: pointer;" onclick="$(\'#confirm,#confirm_bg\').remove();"></div></td></tr><tr height="60" ><td align="left" style="font-size: 17px;color: #c70c10;padding: 40px 0;">　　　　　　　　　　　　　　　只剩'+num+'件啦，还不快抢？！<br />　　　　　　　　　　　　　　　下面这些画材也许更适合你哦！</td></tr><tr height="209" class="ctock_remind_goods_list"><td></td></tr></table></div>';
		html = html+'<div id="confirm" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;z-index: 10000;zoom: 1;background: #fff;filter:alpha(opacity=50);  /*支持 IE 浏览器*/ -moz-opacity:0.50; /*支持 FireFox 浏览器*/ opacity:0.50;  /*支持 Chrome, Opera, Safari 等浏览器*/"></div>';
	$('body').prepend(html);
	$.ajax({url:'alone.php?act=ctock_remind_goods_list',data:{goods_id:id,cat_id:c_id},type:"POST",dataType:"json",success:function(html){
		$('.ctock_remind_goods_list').html(html.content);
	}});
}
//内容页抢购提醒
function Ctf_ctock_remind2(num, id, c_id){
	var html='<div id="confirm" style="width: 556px;height: 383px;position: fixed;z-index: 10001;left: 50%;top: 50%;margin-left: -278px;margin-top: -192px;background: url(/themes/default/pic/stock_remind.png)"><table width="100%" cellpadding="0" cellspacing="0" style="border: none;"><tr height="47"><td><div style="width: 47px;height: 47px;float: right;cursor: pointer;" onclick="$(\'#confirm,#confirm_bg\').remove();"></div></td></tr><tr height="60" ><td align="left" style="font-size: 17px;color: #c70c10;padding: 40px 0;">　　　　　　　　　　　　　　　此商品每人限购'+num+'件哦，还不快抢？！<br />　　　　　　　　　　　　　　　下面这些画材也许更适合你哦！</td></tr><tr height="209" class="ctock_remind_goods_list"><td></td></tr></table></div>';
		html = html+'<div id="confirm" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;z-index: 10000;zoom: 1;background: #fff;filter:alpha(opacity=50);  /*支持 IE 浏览器*/ -moz-opacity:0.50; /*支持 FireFox 浏览器*/ opacity:0.50;  /*支持 Chrome, Opera, Safari 等浏览器*/"></div>';
	$('body').prepend(html);
	$.ajax({url:'alone.php?act=ctock_remind_goods_list',data:{goods_id:id,cat_id:c_id},type:"POST",dataType:"json",success:function(html){
		$('.ctock_remind_goods_list').html(html.content);
	}});
}



function Session(obj,msg){
	$.ajax({url:'alone.php?act=session&',data:{obj:obj,msg:msg},type:"POST",dataType:"json",success:function(html){
	}});
}
	//禁止选中
	$(function(){
		$('.pointer').bind('selectstart',function(){return false;});
	});

// 全选
function all_checkbox(obj){
	if($(obj).length==$(obj+":checked").length){
		$(obj).attr('checked',false);
	}else{
		$(obj).attr('checked',true);
	}
}

// 延迟加载图片
    $(function(){
    	// 判断此方法是否存在
    	if ($.prototype.lazyload != undefined) {
	        $(".loadimg").lazyload({
	             placeholder : "images/defaultico.gif",
	             effect : "fadeIn",
	             failurelimit : 99,
	             threshold:350
	        });
    	}
    });


/* ajax异步加载弹窗信息 */
function ajax_popup(type){
	$.ajax({url:'ajax_loading.php?act='+type+'&',type:"POST",data:{},dataType:"json",success:function(data){
		if (data.content !='null'&&data.content !='undefined'&&data.content !='') {
	       	$('body').append(data.content);
		}else{
			return false;
		};
	}});
}

